package com.trade.okxserver.config;

import com.trade.okxserver.enums.TimeRange;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Data
@Configuration
@ConfigurationProperties(prefix = "okx.config")
public class OkxProperties {

    private String env;

    private Proxy proxy;

    private String instId = "BTC-USDT-SWAP";

    private List<APIKey> apiKeyList;

    private List<String> variables;

    private List<Map<String, String>> customVariableRules;

    private String buyRule;

    private String profit;

    private String loss;

    private KLineConfig kLine;

    OkxProperties() {
        this.env = "real";
        this.proxy = new Proxy();
        this.apiKeyList = new ArrayList<>();
        this.kLine = new KLineConfig();
        this.variables = new ArrayList<>();
        this.customVariableRules = new ArrayList<>();
    }

    @Data
    public static class  Proxy {
        private String host;
        private Integer port;
    }

    @Data
    public static class APIKey {
        private String apiKey;
        private String secretKey;
        private String passphrase;
    }

    @Data
    public static class KLineConfig {
        // 时间段
        private TimeRange timeRange = TimeRange.M1;
        // 开始时间 yyyy-MM-dd HH:mm:ss
        private String startTime;
        // 结束时间 yyyy-MM-dd HH:mm:ss
        private String endTime;
    }

}
